//------------------------------------------------------------------------------ 
//      Copyright (c) 2004-2009, Be Nanashi-San 
// 
//      Permission is hereby granted, free of charge, to any person obtaining a 
//      copy of this software and associated documentation files (the "Software"), 
//      to deal in the Software without restriction, including without limitation 
//      the rights to use, copy, modify, merge, publish, distribute, sublicense, 
//      and/or sell copies of the Software, and to permit persons to whom the 
//      Software is furnished to do so, subject to the following conditions: 
// 
//      The above copyright notice and this permission notice shall be included in 
//      all copies or substantial portions of the Software. 
// 
//      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
//      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
//      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
//      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
//      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
//      FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
//      DEALINGS IN THE SOFTWARE. 
// 
//      File Name:   BoardItem.h
//      Author:      Be Nanashi-San 
//      Description: BBS Board list display class. 
//------------------------------------------------------------------------------
/******************************************************************************
This source code is modified from Haiku's StringItem.h made by Ulrich Wimboeck.
*******************************************************************************/
////////////////////////////////////////////////////////////////////////////////
//
//  File:           StringItem.h
//
//  Description:
//
//  Copyright 2001, Ulrich Wimboeck
//
////////////////////////////////////////////////////////////////////////////////

#ifndef BOARDITEM_H_INCLUDED
#define BOARDITEM_H_INCLUDED

#include <ListItem.h>

enum item_type{
	BOARD_SELECTED = 0,
	BOARD_NORMAL,
	BOARD_CATEGORY
};

class BBitmap;

class BoardItem : public BListItem
{
public:
	BoardItem(const char *text, const char *uri = NULL, int32 type = BOARD_CATEGORY, uint32 outlineLevel = 0, bool expanded = true);
	BoardItem(BMessage *data);
	virtual ~BoardItem();
	virtual status_t Archive(BMessage *data, bool deep = true) const;


	void SetType(const item_type type){fType = type;};
	const char *Text() const {return fLabel;}; 
	const char *Uri() const {return fUri;}; 
	int32 Type() {return fType;};
	virtual void Update(BView *owner, const BFont *font);
	
	static void InitBitmap();
	static void DeleteBitmap();

private:
	static BArchivable	*Instantiate(BMessage *data);
	virtual void DrawItem(BView *owner, BRect frame, bool complete = false);
	BoardItem(const BoardItem &);
	BoardItem& operator=(const BoardItem &);

	void SetLabel(const char *label);
	void SetUri(const char *uri);

	char *fLabel; //板の名前
	char *fUri;  //板のuri
	float fBaselineOffset;
	int32 fType; // キャッシュの有無

	static BBitmap *fRedball;
	static BBitmap *fBlueball;
	static BBitmap *fYellowball;
	static uint32 fCount;
};


#endif /* BOARDITEM_H_INCLUDED */
